﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EasySite.Infrastructure.Security;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace EasySite.Tests.Infrastructure
{
    [TestClass]
    public class CryptoServiceTests
    {
        [TestMethod]
        public void HashEncrypt()
        {
            var hashed = CryptoService.HashEncrypt("password");
            Assert.IsTrue(!string.IsNullOrEmpty(hashed));
        }

        [TestMethod]
        public void MD5Encrypt()
        {
            var key = "EasySiteMD5Key2011";
            var encoded = CryptoService.MD5Encrypt("111111", key);
            Assert.IsTrue(!string.IsNullOrEmpty(encoded));
            var decoded = CryptoService.MD5Decrypt(encoded, key);
            Assert.AreEqual(decoded, "111111");
        }
    }
}
